home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsisode80_tar.Z / vmsisode80_tar / sockit / gccinclude / x11 / xutil.h < prev   
Encoding:
C/C++ Source or Header  |  1990-04-24  |  8.8 KB  |  289 lines

  1. /* $Header: Xutil.h,v 11.39 87/09/12 02:32:45 rws Exp $ */
  2.  
  3. /*
  4. *****************************************************************************
  5. **                                                                          *
  6. **                         COPYRIGHT (c) 1988 BY                            *
  7. **             DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.                *
  8. **               ALL RIGHTS RESERVED                              *
  9. **                                                                          *
  10. **  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
  11. **  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
  12. **  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
  13. **  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
  14. **  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY  *
  15. **  TRANSFERRED.                                                            *
  16. **                                                                          *
  17. **  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
  18. **  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
  19. **  CORPORATION.                                                            *
  20. **                                                                          *
  21. **  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
  22. **  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.                 *
  23. **                                                                          *
  24. *****************************************************************************
  25. **++
  26. **  FACILITY:
  27. **
  28. **    < to be supplied >
  29. **
  30. **  ABSTRACT:
  31. **
  32. **    < to be supplied >
  33. **
  34. **  ENVIRONMENT:
  35. **
  36. **    < to be supplied >
  37. **
  38. **  MODIFICATION HISTORY:
  39. **
  40. **    < to be supplied >
  41. **
  42. **--
  43. **/
  44.  
  45. #ifndef _XUTIL_H_
  46. #define _XUTIL_H_
  47.  
  48. /* 
  49.  * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
  50.  * value (x, y, width, height) was found in the parsed string.
  51.  */
  52. #define NoValue        0x0000
  53. #define XValue      0x0001
  54. #define YValue        0x0002
  55. #define WidthValue      0x0004
  56. #define HeightValue      0x0008
  57. #define AllValues     0x000F
  58. #define XNegative     0x0010
  59. #define YNegative     0x0020
  60.  
  61. typedef struct {
  62.         long flags;    /* marks which fields in this structure are defined */
  63.     int x, y;
  64.     int width, height;
  65.     int min_width, min_height;
  66.     int max_width, max_height;
  67.         int width_inc, height_inc;
  68.     struct {
  69.         int x;    /* numerator */
  70.         int y;    /* denominator */
  71.     } min_aspect, max_aspect;
  72. } XSizeHints;
  73.  
  74. /*
  75.  * The next block of definitions are for window manager properties that
  76.  * clients and applications use for communication.
  77.  */
  78.  
  79. /* flags argument in size hints */
  80. #define USPosition    (1L << 0) /* user specified x, y */
  81. #define USSize        (1L << 1) /* user specified width, height */
  82.  
  83. #define PPosition    (1L << 2) /* program specified position */
  84. #define PSize        (1L << 3) /* program specified size */
  85. #define PMinSize    (1L << 4) /* program specified minimum size */
  86. #define PMaxSize    (1L << 5) /* program specified maximum size */
  87. #define PResizeInc    (1L << 6) /* program specified resize increments */
  88. #define PAspect        (1L << 7) /* program specified min and max aspect ratios */
  89. #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
  90.  
  91. typedef struct {
  92.     long flags;    /* marks which fields in this structure are defined */
  93.     Bool input;    /* does this application rely on the window manager to
  94.             get keyboard input? */
  95.     int initial_state;    /* see below */
  96.     Pixmap icon_pixmap;    /* pixmap to be used as icon */
  97.     Window icon_window;     /* window to be used as icon */
  98.     int icon_x, icon_y;     /* initial position of icon */
  99.     Pixmap icon_mask;    /* icon mask bitmap */
  100.     XID window_group;    /* id of related window group */
  101.     /* this structure may be extended in the future */
  102. } XWMHints;
  103.  
  104. /* definition for flags of XWMHints */
  105.  
  106. #define InputHint         (1L << 0)
  107. #define StateHint         (1L << 1)
  108. #define IconPixmapHint        (1L << 2)
  109. #define IconWindowHint        (1L << 3)
  110. #define IconPositionHint     (1L << 4)
  111. #define IconMaskHint        (1L << 5)
  112. #define WindowGroupHint        (1L << 6)
  113. #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
  114. IconPositionHint|IconMaskHint|WindowGroupHint)
  115.  
  116. /* definitions for initial window state */
  117.  
  118. #define DontCareState 0    /* don't know or care */
  119. #define NormalState 1    /* most applications want to start this way */
  120. #define ZoomState 2    /* application wants to start zoomed */
  121. #define IconicState 3    /* application wants to start as an icon */
  122. #define InactiveState 4    /* application believes it is seldom used; some
  123.                    wm's may put it on inactive menu */
  124.  
  125.  
  126. typedef struct {
  127.     int min_width, min_height;
  128.     int max_width, max_height;
  129.     int width_inc, height_inc;
  130. } XIconSize;
  131.  
  132. typedef struct {
  133.     char *res_name;
  134.     char *res_class;
  135. } XClassHint;
  136.  
  137. /*
  138.  * These macros are used to give some sugar to the image routines so that
  139.  * naive people are more comfortable with them.
  140.  */
  141. #define XDestroyImage(ximage) \
  142.     ((*((ximage)->f.destroy_image))((ximage)))
  143. #define XGetPixel(ximage, x, y) \
  144.     ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
  145. #define XPutPixel(ximage, x, y, pixel) \
  146.     ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
  147. #define XSubImage(ximage, x, y, width, height)  \
  148.     ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
  149. #define XAddPixel(ximage, value) \
  150.     ((*((ximage)->f.add_pixel))((ximage), (value)))
  151.  
  152. /*
  153.  * Compose sequence status structure, used in calling XLookupString.
  154.  */
  155. typedef struct _XComposeStatus {
  156.     char *compose_ptr;        /* state table pointer */
  157.     int chars_matched;        /* match state */
  158. } XComposeStatus;
  159.  
  160. /*
  161.  * Keysym macros, used on Keysyms to test for classes of symbols
  162.  */
  163. #define IsKeypadKey(keysym) \
  164.   (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
  165.  
  166. #define IsCursorKey(keysym) \
  167.   (((unsigned)(keysym) >= XK_Home)     && ((unsigned)(keysym) <  XK_Select))
  168.  
  169. #define IsPFKey(keysym) \
  170.   (((unsigned)(keysym) >= XK_KP_F1)     && ((unsigned)(keysym) <= XK_KP_F4))
  171.  
  172. #define IsFunctionKey(keysym) \
  173.   (((unsigned)(keysym) >= XK_F1)       && ((unsigned)(keysym) <= XK_F35))
  174.  
  175. #define IsMiscFunctionKey(keysym) \
  176.   (((unsigned)(keysym) >= XK_Select)   && ((unsigned)(keysym) <  XK_KP_Space))
  177.  
  178. #define IsModifierKey(keysym) \
  179.   (((unsigned)(keysym) >= XK_Shift_L)  && ((unsigned)(keysym) <= XK_Hyper_R))
  180.  
  181. /*
  182.  * opaque reference to Region data type 
  183.  */
  184. typedef struct _XRegion *Region; 
  185.  
  186. /* Return values from XRectInRegion() */
  187.  
  188. #define RectangleOut 0
  189. #define RectangleIn  1
  190. #define RectanglePart 2
  191.  
  192. /*
  193.  * Information used by the visual utility routines to find desired visual
  194.  * type from the many visuals a display may support.
  195.  */
  196.  
  197. typedef struct {
  198.   Visual *visual;
  199.   VisualID visualid;
  200.   int screen;
  201.   int depth;
  202.   int class;
  203.   unsigned long red_mask;
  204.   unsigned long green_mask;
  205.   unsigned long blue_mask;
  206.   int colormap_size;
  207.   int bits_per_rgb;
  208. } XVisualInfo;
  209.  
  210. #define VisualNoMask        0x0
  211. #define VisualIDMask         0x1
  212. #define VisualScreenMask    0x2
  213. #define VisualDepthMask        0x4
  214. #define VisualClassMask        0x8
  215. #define VisualRedMaskMask    0x10
  216. #define VisualGreenMaskMask    0x20
  217. #define VisualBlueMaskMask    0x40
  218. #define VisualColormapSizeMask    0x80
  219. #define VisualBitsPerRGBMask    0x100
  220. #define VisualAllMask        0x1FF
  221.  
  222. /*
  223.  * This defines a window manager property that clients may use to
  224.  * share standard color maps:
  225.  */
  226.  
  227. typedef struct {
  228.     Colormap colormap;
  229.     unsigned long red_max;
  230.     unsigned long red_mult;
  231.     unsigned long green_max;
  232.     unsigned long green_mult;
  233.     unsigned long blue_max;
  234.     unsigned long blue_mult;
  235.     unsigned long base_pixel;
  236. } XStandardColormap;
  237.  
  238. /*
  239.  * return codes for XReadBitmapFile and XWriteBitmapFile
  240.  */
  241. #define BitmapSuccess        0
  242. #define BitmapOpenFailed     1
  243. #define BitmapFileInvalid     2
  244. #define BitmapNoMemory        3
  245. /*
  246.  * Declare the routines that don't return int.
  247.  */
  248.  
  249. /****************************************************************
  250.  *
  251.  * Context Management
  252.  *
  253.  ****************************************************************/
  254.  
  255.  
  256. /* Associative lookup table return codes */
  257.  
  258. #define XCSUCCESS 0    /* No error. */
  259. #define XCNOMEM   1    /* Out of memory */
  260. #define XCNOENT   2    /* No entry in table */
  261.  
  262. typedef int XContext;
  263.  
  264. #define XUniqueContext()       ((XContext) XrmUniqueQuark())
  265. #define XAtomToContext(atom)   ((XContext) XrmAtomToQuark(atom))
  266.  
  267. extern int XSaveContext(); /* window, context, data */
  268.     /* Window       window;        */
  269.     /* XContext    context;        */
  270.     /* caddr_t      data;        */
  271.  
  272. extern int XFindContext(); /* display, window, context, data */
  273.     /* Display        *display;        */
  274.     /* Window       window;        */
  275.     /* XContext    context;        */
  276.     /* caddr_t      *data;       RETURN */
  277.  
  278. extern int XDeleteContext(); /* window, context */
  279.     /* Window       window;        */
  280.     /* XContext    context;        */
  281.  
  282.  
  283. XWMHints *XGetWMHints();
  284. Region XCreateRegion(), XPolygonRegion();
  285. XImage *XCreateImage();
  286.  
  287. XVisualInfo *XGetVisualInfo();
  288. #endif /* _XUTIL_H_ */
  289.